#ifndef _LIST_H_
#define _LIST_H_

#include "public.h"
#include "common.h"

#define SIZE 20


typedef struct DeviceFd
{
	int fd;
	long lTime;
} dev_fd;

typedef struct List
{
	dev_fd data[SIZE];
	int iCount;
} List;

enum{
	ERROR = -1,
	OK = 0
};

List* CreateList();
void DestroyList(List *pList);
int InsertList(List *pList, dev_fd tData, int iOffset);
int DeleteList(List *pList, dev_fd *pData, int iOffset);
int UpdateList(List *pList, dev_fd tNew, dev_fd tOld);
int SearchItem(List *pList, dev_fd tData);
void ShowList(List *pList);
int DeleteTimeOutDevFromList(List *pList, fd_set *pSet, int iMax);

extern List *g_pList;

#endif //_LIST_H_

